<!--
 * @Files:
 * @Version: 1.0
 * @Author: yujinWang
 * @Date: 2021-01-13 15:51:55
 * @LastEditors: niumengfan
 * @LastEditTime: 2021-02-25 14:45:03
-->
<template>
  <div>
    <el-dialog
      v-bind="$attrs"
      width="500px"
      :close-on-click-modal="false"
      :modal-append-to-body="false"
      v-on="$listeners"
    >
      <el-form ref="elForm" :model="formData" label-width="80px">
        <el-form-item label="表单名称">
          <el-input v-model="formData.formName" />
        </el-form-item>
      </el-form>
      <div slot="footer">
        <el-button @click="close">
          取消
        </el-button>
        <el-button type="primary" @click="handelConfirm">
          确定
        </el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
export default {
  props: {
    formData: {
      type: Object,
      default: () => ({
        formName: ''
      })
    }
  },
  data() {
    return {
    }
  },
  computed: {
  },
  watch: {},
  mounted() {
    console.log(this.formData)
  },
  methods: {
    close() {
      this.$emit('closeFormDialog', false)
    },
    handelConfirm() {
      this.$refs.elForm.validate(valid => {
        if (!valid) return
        this.$emit('confirm', { ...this.formData })
        this.close()
      })
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
